def day7_4():
    list1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 9, 11, 8, 8, 8, 8, 8, ]

    for x in list1:
        count = list1.count(x)
        if count > len(list1) / 2:
            break
    print(x)


def day7_6():
    tuple1 = (1,2,3)
    set1 = {4,5,6}
    print(type(tuple1))
    print(type(set1))
    list1 = list(tuple1) + list(set1)
    print(list1)
    print(type(list1))


def day7_7():
    list1 = [1,2,3,4,5,6]
    list1.append(0)
    list1.insert(0,7)
    print(list1)


def day7_8():
    list1 = [0,1,2,3,4,5,6,7,8]
    list1.reverse()
    print(list1)


def day7_9():
    list1 = [0, 1, 2, 3, 4, 5, 6, 7, 8]
    list1.reverse()
    num = list1.index(5)
    print(num)


def day7_10():
    list1 = [True,False,0,1,2]
    print(list1.count(True))
    print(list1.count(False))
    print(list1.count(0))
    print(list1.count(1))
    print(list1.count(2))


def day7_11():
    list1 = [True, 1, 0, 'x', None, 'x', False, 2, True]
    list1.remove('x')
    list1.remove('x')
    print(list1)


def day7_12():
    list1 = [True, 1, 0,'x', None,'x', False, 2, True]
    list1.pop(4)
    print(list1)


# 13、删除列表中索引号为奇数（或偶数）的元素。  有点问题
# def day7_13():
#     list1 = [True, 1, 0, 'x', None, 'x', False, 2, True]
#     for x in range(0,len(list1)):
#         if x%2 == 0:
#             list1.pop(x)
#             if x < len(list1):
#                 list1.pop(x+1)
#     print(list1)


def day7_14():
    list1 = [True, 1, 0, 'x', None, 'x', False, 2, True]
    list1.clear()
    print()


def day7_15():
    list1 = [3, 0, 8, 5, 7]
    list1.sort()
    print(list1)
    list1.reverse()
    print(list1)


def day7_16():
    list1 = [3, 0, 8, 5, 7]
    for x in range(0,len(list1)):
        if list1[x] > 5:
            list1[x] = 1
        else:
            list1[x] = 0
    print(list1)


def day7_17():
    list1 = ['x','y','z']
    for x in range(0,len(list1)):
        print(list1[x],x)


def day7_18():
    list1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    list2 = []
    list3 = []
    for x in range(0,len(list1)):
        if x%2 == 0:
            list2.append(list1[x])
        else:
            list3.append(list1[x])
    print(list2)
    print(list3)


def day7_24_28():
    dic =  {'Alice': 20, 'Beth': 18, 'Cecil': 21}
    print(list(dic.keys()))
    print(list(dic.values()))
    print(list(dic.items()))
    dic['Cecil']=17
    dic['David']=19
    print(dic)
    dic.pop('Beth')
    print(dic)
    dic.clear()
    print(dic)


def day7_29_30():
    dic = {'Alice': 20, 'Beth': 18, 'Cecil': 21}
    for x in dic:
        print('%s:%s' % (x,dic[x]))
    print('-'*50)
    for x in dic:
        if x == 'Alice':
            print('Alice在字典中')
        elif x == 'David':
            print('David在字典中')




if __name__ == '__main__':
    # day7_4()
    # day7_6()
    # day7_7()
    # day7_8()
    # day7_9()
    # day7_10()
    # day7_11()
    # day7_12()
    # day7_13()
    # day7_14()
    # day7_15()
    # day7_16()
    # day7_17()
    # day7_18()
    # day7_24_28()
    day7_29_30()

